import request from "../../../utils/request";

enum API {
  getPermissionListUrl = "/admin/acl/permission",
  getPermissionByIdUrl = "/admin/acl/permission/toAssign/",
  assignPermissionUrl = "/admin/acl/permission/doAssign/",
  addPermissionUrl = "/admin/acl/permission/save",
  updatePermissionUrl = "/admin/acl/permission/update",
  delPermissionUrl = "/admin/acl/permission/remove/",
}

export const reqGetPermissionList = () => request.get(API.getPermissionListUrl);

export const reqGetPermissionById = (id: number) =>
  request.get(API.getPermissionByIdUrl + id);

export const reqAssignPermission = (param: any) =>
  request.post(API.assignPermissionUrl + "?" + param);

export const reqAddPermission = (info: any) =>
  request.post(API.addPermissionUrl, info);

export const reqUpdatePermission = (info: any) =>
  request.put(API.updatePermissionUrl, info);

export const reqDelPermission = (id: number) =>
  request.delete(API.delPermissionUrl + id);
